package com.qingdai.service.impl;

import com.baomidou.mybatisplus.core.conditions.AbstractLambdaWrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.yulichang.query.MPJLambdaQueryWrapper;
import com.github.yulichang.query.MPJQueryWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.qingdai.emuns.User;
import com.qingdai.entities.CommonResult;
import com.qingdai.mapper.UserMapper;
import com.qingdai.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author LiuZiMing
 * @since 2024-01-26
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Resource
    private UserMapper userMapper;

    @Override
    public User getUserByUsername(String username) {
        MPJQueryWrapper<User> wrapper = new MPJQueryWrapper();
        wrapper.select("*")
                .eq("username", username);
        User user = userMapper.selectOne(wrapper);
        return user;
    }

    @Override
    public User getUserByUserId(Integer id) {
        User user = userMapper.selectById(id);
        return user;
    }
}
